#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "rhomx.h"

/*function rhomx*/
/*creates a iter_z,3 array with material rho parameters*/

void rhomxmat(double rhomatrix[][3], int iter_z, int zmax){



    int part 	    = iter_z - 1;
    int change_iter = (int) part/zmax;
    int change_id   = 1+change_iter;
    int iter        = 1;
    //printf(" %d  ,\n",change_iter);
    //printf(" %d  ,\n",change_id);
    int i;
    for(i = 0;i<iter_z;i++){

        if (i < (change_id-1)){
            switch (iter){
            case 1:
                rhomatrix[i][0] = 1.0;
                rhomatrix[i][1] = 0.0;
                rhomatrix[i][2] = 0.0;
                break;
            case 2:
                rhomatrix[i][0] = 0.0;
                rhomatrix[i][1] = 1.0;
                rhomatrix[i][2] = 0.0;
                break;
            case 3:
                rhomatrix[i][0] = 0.0;
                rhomatrix[i][1] = 0.0;
                rhomatrix[i][2] = 1.0;

                break;
            default:
                break;
            }

        }

        if (i == (change_id-1)){
            switch (iter){
            case 1:
                rhomatrix[i][0] = 1.0;
                rhomatrix[i][1] = 1.0;
                rhomatrix[i][2] = 0.0;
                break;

            case 2:
                rhomatrix[i][0] = 0.0;
                rhomatrix[i][1] = 1.0;
                rhomatrix[i][2] = 1.0;
                break;
            case 3:
                rhomatrix[i][0] = 0.0;
                rhomatrix[i][1] = 0.0;
                rhomatrix[i][2] = 1.0;
                break;
            default:
                break;

            }

        change_id = change_id+change_iter;
        iter = iter+1;
        }
    }

}





